<?php

namespace App\Http\Controllers;

use App\Models\Person;
use SimpleSoftwareIO\QrCode\Facades\QrCode;

class IndexController extends Controller
{
    public function index() {
        return view('welcome');
    }

    public function person($id) {
        $person = Person::find($id);
        return view('person')->with([
            'person' => $person
        ]);
    }

    public function view($id) {
        $person = Person::find($id);
        $url = url('person/'. $id);
        $qrcode = QrCode::size(100)->generate($url);

        return view('admin.person.view')->with([
            'person' => $person,
            'qrcode' => $qrcode
        ]);
    }
}
